if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_insertOrder]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_insertOrder]
GO
CREATE PROC sp_insertOrder
	@acc			int,
	@totalAmount	varchar(20),
	@discount		int,
	@id				int			output
AS
BEGIN
	DECLARE @date datetime
	SET @date=getDate()
	INSERT INTO OrderRequest (AccountID, Date, TotalAmount, Status, LastUpdate, Discount)
		VALUES ( @acc, @date, @totalAmount, 0, @date, @discount)
	SELECT @id=ID FROM OrderRequest WHERE Date = @date
END